import Vue from 'vue'
import Router from 'vue-router'

import login from '@/pages/pcs/login'
import manage from '@/pages/pcs/manage'
import home from '@/pages/pcs/home'
import iframe from '@/pages/pcs/iframepage'

//小程序后台
import mallCreate from '@/pages/pcs/mallCreate'
import mallCreateByLink from '@/pages/pcs/mallCreateByLink'
import mallList from '@/pages/pcs/mallList'
import mallOrder from '@/pages/pcs/mallOrder'
import mallOrderAll from '@/pages/pcs/mallOrderAll'
import mallShops from '@/pages/pcs/mallShops'
import mallPostage from '@/pages/pcs/mallPostage'
import mallModList from '@/pages/pcs/mallModList'
import mallModByLink from '@/pages/pcs/mallModByLink'
import mallSwiPer from '@/pages/pcs/mallSwiPer'
import mallContact from '@/pages/pcs/mallContact'
import userList from '@/pages/pcs/userList'
import userList_yy from '@/pages/pcs/userList_yy'
import waitCashList from '@/pages/pcs/waitCashList'
import cashRecord from '@/pages/pcs/cashRecord'
import sendedList from '@/pages/pcs/sendedList'
import itemCate  from  '@/pages/pcs/itemCate'
import hotItems  from  '@/pages/pcs/hotItems'
import constantList  from  '@/pages/pcs/constantList'
import versionConstant  from  '@/pages/pcs/versionConstant'
import goodsFromOther  from  '@/pages/pcs/goodsFromOther'
import indexHotWord  from  '@/pages/pcs/indexHotWord'
import limitTimeGoodsList  from  '@/pages/pcs/limitTimeGoodsList'
import activityList  from  '@/pages/pcs/activityList'
import dailyReport  from  '@/pages/pcs/dailyReport'

//购买
import mallPerfect  from  '@/pages/buyer/mallDetailsPerfecth5'
import mallDetails  from  '@/pages/buyer/mallDetails'
import payOk  from  '@/pages/buyer/mallPayMoneyOk'

//app下载
import appDownload  from  '@/pages/download/appDownload'
//app邀请注册
import inviteRegister  from  '@/pages/invite/register'

import * as config from '../config/const';

Vue.use(Router);


export default new Router({
  mode: 'history',
  data() {
    return {}
  },
  routes: [
    {
      path: '/',
      name: 'login',
      component: login,
      meta: {}
    },
    {
      path: '/login',
      name: 'login',
      component: login,
      meta: {}
    },
    {
      path: '/admin',
      component: manage,
      name: 'manage',
      children: [
        {
          path: '',
          name: 'home',
          component: home,
          meta: {
            title: '首页',
            filter: config.AUTH_FILTER.admin
          }
        },
        {
          path: '/frame/:backurl',
          name: 'iframe',
          component: iframe,
          meta: {
            title: '外链页面'
          }
        },
        {
          path: 'mallCreate',
          name: 'mallCreate',
          component: mallCreate,
          meta: {
            title: '商品发布'
          }
        },
        {
          path: 'mallCreateByLink',
          name: 'mallCreateByLink',
          component: mallCreateByLink,
          meta: {
            title: '商品发布'
          }
        },
        {
          path: 'mallList',
          name: 'mallList',
          component: mallList,
          meta: {
            title: '商品列表'
          }
        },
        {
          path: 'mallOrder',
          name: 'mallOrder',
          component: mallOrder,
          meta: {
            title: '订单管理'
          }
        },
        {
          path: 'mallOrderAll',
          name: 'mallOrderAll',
          component: mallOrderAll,
          meta: {
            title: '全部订单'
          }
        },
        {
          path: 'mallShops',
          name: 'mallShops',
          component: mallShops,
          meta: {
            title: '商家管理'
          }
        },
        {
          path: 'mallPostage',
          name: 'mallPostage',
          component: mallPostage,
          meta: {
            title: '物流模板'
          }
        },
        {
          path: 'mallModList/:itemId',
          name: 'mallModList',
          component: mallModList,
          meta: {
            title: '修改商品信息'
          }
        },
        {
          path: 'mallModByLink/:itemId',
          name: 'mallModByLink',
          component: mallModByLink,
          meta: {
            title: '修改商品信息'
          }
        },
        {
          path: 'goodsFromOther/:itemCode',
          name: 'goodsFromOther',
          component: goodsFromOther,
          meta: {
            title: '发布商品'
          }
        },
        {
          path: 'goodsFromOther',
          name: 'goodsFromOther',
          component: goodsFromOther,
          meta: {
            title: '发布商品'
          }
        },
        {
          path: 'mallSwiPer',
          name: 'mallSwiPer',
          component: mallSwiPer,
          meta: {
            title: '轮播图'
          }
        },
        {
          path: 'mallContact',
          name: 'mallContact',
          component: mallContact,
          meta: {
            title: '客服管理'
          }
        },
        {
          path: 'userList',
          name: 'userList',
          component: userList,
          meta: {
            title: '用户管理'
          }
        },
        {
          path: 'userList_yy',
          name: 'userList_yy',
          component: userList_yy,
          meta: {
            title: '用户管理'
          }
        },
        {
          path: 'waitCashList',
          name: 'waitCashList',
          component: waitCashList,
          meta: {
            title: '提现审核'
          }
        },
        {
          path: 'cashRecord',
          name: 'cashRecord',
          component: cashRecord,
          meta: {
            title: '审核记录'
          }
        },
        {
          path: 'sendedList',
          name: 'sendedList',
          component: sendedList,
          meta: {
            title: '审核记录'
          }
        },
        {
          path: 'itemCate',
          name: 'itemCate',
          component: itemCate,
          meta: {
            title: '类目'
          }
        },
        {
          path: 'hotItems',
          name: 'hotItems',
          component: hotItems,
          meta: {
            title: '热销商品'
          }
        },
        {
          path: 'constantList',
          name: 'constantList',
          component: constantList,
          meta: {
            title: '所有常量'
          }
        },
        {
          path: 'versionConstant',
          name: 'versionConstant',
          component: versionConstant,
          meta: {
            title: '版本常量'
          }
        },
        {
          path: 'indexHotWord',
          name: 'indexHotWord',
          component: indexHotWord,
          meta: {
            title: '首页热搜词'
          }
        },
        {
          path: 'limitTimeGoodsList',
          name: 'limitTimeGoodsList',
          component: limitTimeGoodsList,
          meta: {
            title: '限时抢购'
          }
        },
        {
          path: 'dailyReport',
          name: 'dailyReport',
          component: dailyReport,
          meta: {
            title: '每日交易报表'
          }
        },
        {
          path: 'activityList',
          name: 'activityList',
          component: activityList,
          meta: {
            title: '活动管理'
          }
        },
      ]
    },
    {
      path: '/share/mallDetails',
      name: 'mallDetails',
      component: mallDetails,
      meta: {
        title: '商品详情'
      }
    },
    {
      path: '/share/mallDetailsPerfecth5/:tradeCode',
      name: 'mallDetailsPerfecth5',
      component: mallPerfect,
      meta: {
        title: '订单完善'
      }
    },
    {
      path: '/share/mallPayMoneyOk',
      name: 'mallPayMoneyOk',
      component: payOk,
      meta: {
        title: '支付成功'
      }
    },
    {
      path: '/download/appDownload',
      name: 'appDownload',
      component: appDownload,
      meta: {
        title: '惠优品下载'
      }
    },
    {
      path: '/invite/register',
      name: 'inviteRegister',
      component: inviteRegister,
      meta: {
        title: '新用户注册'
      }
    }
  ]
})
